<?php
declare (strict_types = 1);

namespace app\shop31\controller;
use think\facade\Cache;
use \think\facade\View;
use \think\facade\Db;
use \think\facade\Request;

class Order{
    public function order_list()
    {

        $where=[];
        $param=Request::param();
        View::assign($param);


//
//        if (isset($post['cid']) && $post['cid'] <> '')             $where[]=['status','=',$post['cid']];
//        if (isset($post['num1']) && $post['num1'] <> '')             $where[]=['price','<=',$post['num1']];
//        if (isset($post['num2']) && $post['num2'] <> '')             $where[]=['price','>=',$post['num2']];

//        if (isset($cid) && $cid <> '')   $where[]=['status','=',$cid];
//        if (isset($num1) && $num1 <> '')   $where[]=['price','<=',$num1];
//        if (isset($num2) && $num2 <> '')   $where[]=['price','>=',$num2];
        if (isset($param['cid']) && !empty($param['cid'])) $where['cid']=$param['cid'];
        if (isset($param['name']) && !empty($param['name'])) $where['name']=$param['name'];
        if (isset($param['num1']) && !empty($param['num1'])) $where['num1']=$param['num1'];
        if (isset($param['num2']) && !empty($param['num2'])) $where['num2']=$param['num2'];
        if (isset($param['name']) && !empty($param['name'])) $where['name']=$param['name'];

//        echo $name=\think\facade\Request::param('name');
//        if (isset($post['name']) && ($post['name']) <> '')  $where[]=['aname','like',"%{$post['name']}%"];


//        $adv = \think\facade\Db::name('order')
//                ->alias("a")
//                ->where('a.aname','like',"%{$name}%")
//                ->where($where)
//                ->join('order_status c','a.status=c.status_id')
//                ->field("a.id,a.aname,a.atel,a.addtime,a.status,a.remark,c.order_status,a.price")
//                ->select();

        $adv=\app\shop31\model\Order::GetOrderList($where,$param);
        $sql=\think\facade\Db::name('order_status')->select();
        View::assign('adv',$adv);
        View::assign('sql',$sql);
        //助手函数  -  渲染视图
        return view();
    }

    public function order_detail()
    {
        //助手函数  -  渲染视图

        return view();
    }
}